package com.apes.scm.masterdata.multiKeys;

import com.apes.scm.masterdata.frame.model.Channel;
import com.apes.scm.masterdata.frame.model.Organization;
import com.apes.scm.masterdata.product.model.ProductGroup;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author HuJianlin
 * @create 2018-03-08 11:09
 */
@Data
@Embeddable
public class SalesTerritory implements Serializable {


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "sales_org_id", referencedColumnName = "id")
    private Organization salesOrg; //销售组织


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "product_group_id", referencedColumnName = "id")
    private ProductGroup productGroup; //商品组


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "channel_id", referencedColumnName = "id")
    private Channel channel; //渠道

    public SalesTerritory(){

    }

    @Override
    public String toString() {
        return "[" + salesOrg + ", " + productGroup + ", " + channel + "]";
    }
}
